<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>预解析</title>
  </head>
  <body>
    <script>
      var b = 'boy';
      console.log(b); //boy
      function fighting() {
        console.log(a);  //undefined
        console.log(c);   ////undefined
        if (a === 'apple') {
          a = 'Alice';
        } else {
          a = 'Ada';
        }
        console.log(a); //'Ada'
        var a = 'Andy';
        middle();
        function middle() {
          console.log(c++); //NaN  这里没有定义c++ 
          var c = 100;
          console.log(++c); //101
          small();
          function small() {
            console.log(a); // 'Andy';
          }
        }
        var c = (a = 88);
        function bottom() {
          b = 'baby';
          console.log(b);  //baby'
        }
        bottom();
      }
      fighting();
      //   b = 'baby'; 在函数里面没有var 声明 就是是挂载到全局变量自动加 var  覆盖了最上面上面的var b = 'boy';
      console.log(b); //baby

    </script>
  </body>
</html>
